/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thienphuc.patient.bo.impl;

import java.util.List;
import thienphuc.patient.bo.DonViTinhBO;
import thienphuc.patient.dao.DonViTinhDAO;
import thienphuc.patient.dao.impl.DonViTinhDAOImpl;
import thienphuc.patient.dto.DonViTinh;

/**
 *
 * @author QuocDat
 */
public class DonViTinhBOImpl implements DonViTinhBO {

    private DonViTinhDAO donViTinhDAO;

    public DonViTinhBOImpl() {
        this.donViTinhDAO = new DonViTinhDAOImpl(DonViTinh.class);
    }

    public List<DonViTinh> getAll() throws Exception {
        return this.donViTinhDAO.findAll();
    }

    public DonViTinh getById(int maDonViTinh) throws Exception {
        return this.donViTinhDAO.findById(maDonViTinh);
    }

    public List<DonViTinh> getByTenDonViTinh(String tenDonViTinh) throws Exception {
        return this.donViTinhDAO.findByTenDonViTinh(tenDonViTinh);
    }

    public boolean insertDonViTinh(DonViTinh donViTinh) throws Exception {
        return this.donViTinhDAO.save(donViTinh);
    }

    public boolean updateDonViTinh(DonViTinh donViTinh) throws Exception {
        return this.donViTinhDAO.update(donViTinh);
    }
}
